export type JsCode = {
  code: string;
  expires: number
}

export type Org = {
  orgId: string;
  orgName: string;
  ownStatus: boolean;
  loginStatus?: boolean;
  orgNo?: string;
}

export interface Auth {
  jsCodeObj: JsCode;
  loginStatus: boolean;
  token: string;
  refresh_token: string;
  expires_in: number;
  userId: string;
  roles: string[];
  realName: string;
  subscription: AccessItem[];
  orgs: Org[];
  userInfo: Taro.UserInfo;
  userApproveStatus: number;
  orgApproveStatus: number;
  idCardNo: string;
  sexual: number;
  desc: string;
}

export type AccessItem = {
  optionName: string; //功能名称
  optionValue: string; //功能值
  logo: string; //logo
}

export type TokenInfo = {
  authorities: string[];
  access_token: string;
  token_type: string;
  refresh_token: string;
  expires_in: number;
  scope: string;
  jti: string;
}

export type OrgTokenInfo = {
  org_id: string;
  authorities: string[];
  access_token: string;
  token_type: string;
  refresh_token: string;
  expires_in: number;
  scope: string;
  jti: string;
}

export type LoginResult = {
  userInfo: Taro.UserInfo;
  tokenInfo: TokenInfo;
}

export type TokenCheckInfo = {
  active: boolean;
  exp: number;
  scope: string[];
  sub: string;
  roles: string[];
}

export type TokenPayload = {
  sub: string;
  scope: string[];
  exp: number;
  authorities: string[];
  ati?: string;
  jti: string;
  client_id: string;
}